﻿using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Xml.Serialization;

namespace QDP.Contracts
{
    /// <summary>表示一个组件导航基础类</summary>
    [DataContract]
    public class NavigationBase:ObservableObject
    {
        public NavigationBase()
        {
            SubNotes = new List<NavigationBase>();
        }
        /// <summary>获取或设置组件的编码，唯一标识。</summary>
        [DataMember, XmlAttribute]
        public string Code { get; set; }
        /// <summary>获取或设置组件的标题。</summary>
        [DataMember, XmlAttribute]
        public string Caption { get; set; }
        /// <summary>获取或设置组件的参数表达式。</summary>
        [DataMember, XmlAttribute]
        public string ParmsExpression { get; set; }
        /// <summary>获取或设置组件的关键字</summary>
        [DataMember, XmlAttribute]
        public string Tags { get; set; }
        [DataMember]
        [XmlArrayItem("NavUISLXap", typeof(NavUISLXap))
        , XmlArrayItem("NavDirectory", typeof(NavDirectory))]
        public List<NavigationBase> SubNotes { get; set; }
        /// <summary>获取或设置组件的提示信息。</summary>
        [DataMember, XmlAttribute]
        public string Description { get; set; }
        /// <summary>获取或设置应用组件的图标（大）</summary>
        [DataMember,XmlAttribute]
        public string ImageUrl1 { get; set; }
        /// <summary>获取或设置应用组件的图标（小）</summary>
        [DataMember,XmlAttribute]
        public string ImageUrl2 { get; set; }
        /// <summary>获取或设置组件背景色</summary>
        [DataMember, XmlAttribute]
        public string Background { get; set; }
        /// <summary>获取或设置组件前景色</summary>
        [DataMember, XmlAttribute]
        public string Foreground { get; set; }
        /// <summary>获取或设置承载组件的DLL文件路径及名称。</summary>
        [DataMember, XmlAttribute]
        public string Source { get; set; }
        /// <summary>获取或设置承载组件的XAP压缩包。</summary>
        [DataMember, XmlAttribute]
        public string Package { get; set; }
        /// <summary>获取或设置承载组件的Class命名空间及名称。</summary>
        [DataMember, XmlAttribute]
        public string Type { get; set; }

        private bool isChecked = false;
        [DataMember, XmlAttribute]
        public bool IsChecked
        {
            get { return this.isChecked; }
            set
            {
                if (this.isChecked == value) return;
                this.isChecked = value;
                this.Notify("IsChecked");
            }
        }
    }
}